package com.ft.core.exceptions;

import com.ft.core.exceptions.inner.FanTuException;

/**
 * @copyright (C), 2015-2019, 梵途科技有限公司
 * @fileName: SystemException
 * @author: 李阳
 * @date: 2019/4/17 11:04
 * @description: 系统异常
 */
public class SystemException extends FanTuException {
    private static final long serialVersionUID = 1641672649969274203L;
    /**
     * 无构造实例化
     */
    public SystemException() {
        super();
        this.setCode(SystemErrorCode.SYSTEM_ERROR_CODE);
    }

    /**
     * 实例化
     *
     * @param message 消息
     */
    public SystemException(String message) {
        super(message);
        this.setCode(SystemErrorCode.SYSTEM_ERROR_CODE);
    }

    /**
     * 实例化
     *
     * @param message 消息
     * @param cause   源异常
     */
    public SystemException(String message, Throwable cause) {
        super(message, cause);
        this.setCode(SystemErrorCode.SYSTEM_ERROR_CODE);
    }

    /**
     * 实例化
     *
     * @param cause 源异常
     */
    public SystemException(Throwable cause) {
        super(cause);
        this.setCode(SystemErrorCode.SYSTEM_ERROR_CODE);
    }

    /**
     * 实例化
     *
     * @param message            消息
     * @param cause              源异常
     * @param enableSuppression
     * @param writableStackTrace 写入跟踪
     */
    protected SystemException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.setCode(SystemErrorCode.SYSTEM_ERROR_CODE);
    }

    @Override
    public final ExceptionLevel getLevel() {
        return ExceptionLevel.SYSTEM;
    }
}
